package com.wyix.log.excutor;

import com.wyix.log.domain.Order;
import com.wyix.log.service.MilkTeaLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 当存在Slf4j时提供的日志增强器
 *
 * @author wangdx
 * @since 2025/8/20
 */
public class Slf4jLogEnhancer {
    private static final Logger logger = LoggerFactory.getLogger(Slf4jLogEnhancer.class);
    private final MilkTeaLogService logService;

    public Slf4jLogEnhancer(MilkTeaLogService logService) {
        this.logService = logService;
        logger.info("Slf4j日志增强器已启用");
    }

    // 增强的订单创建日志
    public void enhancedLogOrderCreate(Order order) {
        logger.info("增强型日志 - 订单[{}]创建", order.getOrderNo());
        logService.logOrderCreate(order);
    }

    // 增强的订单完成日志
    public void enhancedLogOrderComplete(Order order) {
        logger.info("增强型日志 - 订单[{}]完成", order.getOrderNo());
        logService.logOrderComplete(order);
    }
}
